<template>
  <div class="page-box">
    <div class="tabs">
      <tabBar
        :list="tabs"
        :active-index="tabActive"
        @change="tabChange"
      ></tabBar>
    </div>
    <div class="user-box" v-show="tabActive === 0||tabActive === 2">
      <goodsList ref="goodsList" @goConfig="goConfig"></goodsList>
    </div>
    <div class="user-box" v-show="tabActive === 1">
      <supplyconfig ref="supplyconfig"></supplyconfig>
    </div>
    <!-- <div class="user-box" v-show="tabActive === 3">
      <noticeDetail ref="noticeDetail" :noticeContent="helpContent"></noticeDetail>
    </div> -->
  </div>
</template>

<script>
import tabBar from "@/components/tenant/tabBar.vue";
import goodsList from "./goodsList";
import supplyconfig from "./components/supplyconfig.vue"
// import noticeDetail from "../components/noticeDetail.vue";
// import {gonggaoDetails} from "@/api/system/notice.js"
export default {
  name: "",
  components: { tabBar, goodsList,supplyconfig },
  data() {
    return {
      tabActive: 0,
      listType:'sale',
      tabs: [
        {
          name: "销售列表",
          value: 1,
        },
        {
          name: "货源配置",
          value: 2,
        },
        {
          name: "账号池",
          value: 3,
        },{
          name: "如何使用",
          value: 4,
        },
        
      ],
      helpContent:''
    };
  },
  created() {
  },
  mounted(){

  },
  methods: {
    tabChange(e) {
      this.tabActive = e.index;
      if(e.index===0){
        // this.listType = 'sale'
        this.$refs.goodsList.initPage('sale')
      }
      if(e.index==2){
        // this.listType = 'pool'
        this.$refs.goodsList.initPage('pool')
      }
      if(e.index==1){
        // this.$refs.supplyconfig.getDetail()
        /**
         * this.$nextTick(()=>{
          this.$router.push({
            name:'SupplyConfigpage'
          })
        })
         */
      }
      // if(e.index==3){
      //   this.getNotice()
      // }
    },
    goConfig(){
      this.tabActive = 1
      this.$refs.supplyconfig.getDetail()
    },
    // 如何使用
    getNotice(){
      gonggaoDetails({noticeType:'shXstRhsy'}).then(res=>{
        if(res&&res.length){
          this.helpContent = res[0].noticeContent
          this.$refs.noticeDetail.getAllImg()
        }
      })
    }
  },
};
</script>

<style scoped lang="scss">
.page-box {
  // padding-bottom: 30px;
  .tabs {
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    margin-bottom: 16px;
  }
}
</style>
